www.gusucode.com > 茶都拼客网全功能版 8 > 茶都拼客网全功能版 8.8源码程序/teasdxmccom/茶都拼客网V8.8(全功能,无限制,完全开源)/admin/Ku_News.asp

    <!--#include file="../Ku_inc/Ku_sql.asp"-->
<!--#include file="../Ku_inc/Ku_config.asp"-->
<!--#include file="Ku_conn.asp"-->

<!--#include file="../Ku_inc/inc.asp"-->
<!-- #include file="fckeditor/fckeditor.asp" -->
<!-- #include file="Session.asp"-->
<html>
<title>管理网站新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript">
    <!--
    function doSubmit(){
		if (document.NewForm.Title.value==""){
			alert("新闻标题不能为空!");
			return false;
		}
		if (document.NewForm.G_webclass.value==""){
			alert("请选择新闻类别哟!");
			return false;
		}				
		if (Content.getHTML()==""){
			alert("新闻内容不能为空!");
			return false;
		}
		return true;
	}
    //-->
</script>
<link href="include/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" align="center"><a href="Ku_news.asp?action=Add">添加新闻内容</a> 
| <a href="Ku_news.asp">管理新闻内容</a></td>
</tr>
</table>
<br>
<%
    Set rs = Server.CreateObject("ADODB.Recordset")
    if request("action")="Edit" then
    id=request.querystring("id")
    CheckAdmin2
    rs.Open "Select * From ku_news where id="&id, conn,3,3
    s_content=rs("content")
%>
<form action="Ku_news.asp?Action=Modify" method="POST" name="NewForm" id="NewForm"> 
<table width="800" height="178" border="0" align="center" cellpadding="1" cellspacing="1" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
<tr bgcolor="#F6F6F6"> 
<td height="24" align=center>新闻信息修改</td>
</tr>
<tr bgcolor="#FFFFFF"> 
<td height="23">
&nbsp;&nbsp;新闻标题: 
<input type="text" name="Title" size="30" value="<%=rs("Title")%>"> 
<input type=hidden name=id value="<%=rs("id")%>"> 
<input name="New_tuijian" type="checkbox" id="New_tuijian" style="border:0px" value="True" <%if rs("New_tuijian")=true then response.Write("checked") end if%>>新闻推荐
(首页图文显示)
</td>
</tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="23" align="left" valign="middle">&nbsp;&nbsp;内容图片: 
        <input name="pic" type="text" id="pic" size="30" value="<%=rs("pic")%>">
        [<a href="JavaScript:openem()">上传图片</a>][<a href="javascript:preview()">图片预览</a>] 
      </td>
    </tr>
    <tr  bgcolor="#FFFFFF">
              
              <td height="23">&nbsp; 新闻类型: <select name="G_webclass" id="G_webclass">
<option value="0">新闻类别</option>
<%set rslb=server.createobject("adodb.recordset")
sql="select * from [Ku_newsclass]"
rslb.open sql,conn,1,1
if rslb.eof and rslb.bof then
response.write ("<option value=0>暂无分类</option>")
else
do while not rslb.eof%>
<option value="<%=rslb("G_classid")%>"><%=rslb("G_class")%></option>
<%rslb.movenext
loop
rslb.close
end if%>
</select><font color="#FF0000">*</font><input name="shenhe" type="checkbox" id="shenhe" style="border:0px" value="True" <%if rs("shenhe")=true then response.Write("checked") end if%>><font color="#FF0000">通过审核</font></td>
            </tr> 
<tr bgcolor="#FFFFFF"> 
<td height="23">&nbsp;&nbsp;新闻内容:</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="65"> 
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "/aspbar/admin/fckeditor/" 
oFCKeditor.ToolbarSet = "Default" 
oFCKeditor.Width = "100%" 
oFCKeditor.Height = "400" 
oFCKeditor.Value = s_content
oFCKeditor.Create "content" 
%>
</td>
</tr>
<tr bgcolor="#F6F6F6">
<td height="24" align=center> <input type="submit" name="Submit" value=" 提交 " onClick="return doSubmit()"> 
<input type="reset" name="reset" value=" 重置 "></td>
</tr>
</table>
</form>
<% end if %>
<%
    if request("action")="Add" then 
    CheckAdmin1
%>
<form action="Ku_news.asp?Action=Save" method="post" name="NewForm" id="NewForm">
<table width="800" height="249" border="0" align="center" cellpadding="1" cellspacing="1" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
<tr> 
<td height="24" align=center bgcolor="#F6F6F6">添加新闻信息</td>
</tr>
<tr bgcolor="#FFFFFF"> 
<td height="24">
&nbsp;&nbsp;新闻标题:
<input name="Title" type="text" id="Title" size="30"> 
<input name="New_tuijian" type="checkbox" id="New_tuijian" style="border:0px" value="True">新闻推荐 (首页图文显示)
</td>
<tr  bgcolor="#FFFFFF">
              
              <td height="23">&nbsp; 新闻类型: <select name="G_webclass" id="G_webclass">
<option value="0">新闻类别</option>
<%set rslb=server.createobject("adodb.recordset")
sql="select * from [Ku_newsclass]"
rslb.open sql,conn,1,1
if rslb.eof and rslb.bof then
response.write ("<option value=0>暂无分类</option>")
else
do while not rslb.eof%>
<option value="<%=rslb("G_classid")%>"><%=rslb("G_class")%></option>
<%rslb.movenext
loop
rslb.close
end if%>
</select><font color="#FF0000">*</font><input name="shenhe" type="checkbox" id="shenhe" style="border:0px" value="True"><font color="#FF0000">通过审核</font></td>
            </tr> 

</tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="23" align="left" valign="middle">&nbsp;&nbsp;内容图片: 
        <input name="pic" type="text" id="pic" size="30" >
        [<a href="JavaScript:openem()">上传图片</a>][<a href="javascript:preview()">图片预览</a>] 
      </td>
    </tr>
<tr bgcolor="#FFFFFF"> 
<td height="24">&nbsp;&nbsp;新闻内容:</td>
</tr>
<tr bgcolor="#FFFFFF"> 
<td height="147">
<%

Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "/aspbar/admin/fckeditor/" 
oFCKeditor.ToolbarSet = "Default" 
oFCKeditor.Width = "100%" 
oFCKeditor.Height = "400" 
oFCKeditor.Value = ""
oFCKeditor.Create "Content" 
%>
</td>
</tr>
<tr bgcolor="#F6F6F6"> 
<td height="24" align=center> <input type="submit" name="Add" value=" 添加 " onClick="return doSubmit()"><input type="reset" name="Reset" value=" 重置 "></td>
</tr>
</table>
</form>
<% end if %>
<%
    if request("action") = "" then
    CheckAdmin1
    If Request.QueryString("CurPage") = "" or Request.QueryString("CurPage") = 0 then
    CurPage = 1
    Else
    CurPage = CINT(Request.QueryString("CurPage"))
    End If
    rs.Open "Select * From ku_news Order By id DESC", conn, 1,1
    if rs.eof and rs.bof then
    Response.Write("<P align='center'>暂时没有任何记录!</P>")
    else

    RS.PageSize=16 '设置每页记录数
    Dim TotalPages
    TotalPages = RS.PageCount
    If CurPage>RS.Pagecount Then
    CurPage=RS.Pagecount
    end if
    RS.AbsolutePage=CurPage
    rs.CacheSize = RS.PageSize'设置最大记录数  
    Dim Totalcount
    Totalcount =INT(RS.recordcount)
    StartPageNum=1
    do while StartPageNum+10<=CurPage
    StartPageNum=StartPageNum+10
    Loop
    EndPageNum=StartPageNum+9
    If EndPageNum>RS.Pagecount then EndPageNum=RS.Pagecount
%>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="1" bordercolorlight="#999999" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
  <tr> 
    <td width="283" height="20" bgcolor="#F6F6F6"><div align="center">&nbsp;标题</div></td>
    <td width="85" height="20"  align="center" bgcolor="#F6F6F6">时 间</td>
        <td width="95" height="23" align="center" bgcolor="#F6F6F6">类别</td>
        <td width="39" height="23" align="center" bgcolor="#F6F6F6">审核</td>
    <td width="106" height="23" align="center" bgcolor="#F6F6F6">操作</td>
  </tr>
<%
    I=0
    p=RS.PageSize*(Curpage-1)              
    do while (Not RS.Eof) and (I<RS.PageSize)              
    p=p+1
%>
  <tr bgcolor="#FFFFFF">
<td height="19" align=left bordercolorlight="#C0C0C0">&nbsp;<img src="ku_img/art_doc.gif">&nbsp;<a href="NewsInfo.asp?id=<%=rs("id")%>" target="_blank"><%=left(rs("Title"),18)%>...</a><%if rs("New_tuijian")=true then%>[<font color="#FF0000">荐</font>]<%else%>[<font color="#0000FF">普</font>]<%end if%></td>
    <td  align="center">[<%=rs("time")%>]</td>

    <%set rslb=server.createobject("adodb.recordset")
sql="select * from [Ku_newsclass] where G_classid="&rs("class")&""
rslb.open sql,conn,1,1
if rslb.eof and rslb.bof then
%><td align="center">暂无分类</td>
<%else%>
<td align="center"><%=rslb("G_class")%></td>
<%end if%>
<!--审核--> 
<td align="center">
<%
if rs("shenhe")=true then
%>√<%else%><a href="Ku_news.asp?Action=pass&id=<%=rs("id")%>"><font color="#FF0000">×</font></a><%end if%>
</td>
    <td height="23" align=middle bordercolorlight="#c0c0c0" bgcolor="#FFFFFF" width="106"><div align="center"><a href="Ku_news.asp?Action=Edit&id=<%=rs("id")%>">修改</a> 
| <a href="News_Modify.asp?id=<%=rs("id")%>"></a><a href="Ku_news.asp?Action=Del&id=<%=rs("id")%>">删除</a><a href="News_Modify.asp?id=<%=rs("id")%>"></a></div></td>
  </tr>
<%
    I=I+1              
    RS.MoveNext              
    Loop
%>
  <tr bgcolor="#FFFFFF"> 
    <td height="23" colspan=6 align="center" bordercolorlight="#C0C0C0">页次: <font color="#CC0000"><%=CurPage%></font>/<%=TotalPages%> 
      页数: <a href="Ku_news.asp?CurPage=<%=StartPageNum-1%>">&lt;&lt;</a> 
      <% For I=StartPageNum to EndPageNum                
      if I<>CurPage then %>
      <a href="Ku_news.asp?CurPage=<%=I%>"><%=I%></a> 
<% else %>
<%=I%> 
<% end if %>
<% Next %>
<% if EndPageNum<RS.Pagecount then %>
      <a href="Ku_news.asp?CurPage=<%=EndPageNum+1%>">下页</a> 
<%end if%>
|<a href="Ku_news.asp">刷 新</a></td>
  </tr>
</table>
</body>
</html>
<%
    end if
    rs.close
    set rs=nothing
    end if
%> 
<%
    if request("Action")="Save" then

    Title=strFilter(request("Title"))
    G_webclass=strFilter(request("G_webclass"))    
    Content=strFilter(request("Content"))
    pic=strFilter(request("pic"))
    If Title="" Then
    Response.Write "<script>alert(""请输新闻标题!"");location.href=""javascript:history.back()"";</script>"
    Response.end()
    end if
    If G_webclass="0" Then
    Response.Write "<script>alert(""请选择新闻类别!"");location.href=""javascript:history.back()"";</script>"
    Response.end()
    end if    
    If Content="" Then
    Response.Write "<script>alert(""请输新闻内容!"");location.href=""javascript:history.back()"";</script>"
    Response.end()
    end if
    sql="select * From ku_news "
    rs.open sql,conn,3,2
    rs.addnew
    rs("Title")=Title
    rs("class")=G_webclass
    rs("Content")=Content
    rs("pic")=pic
    if Request("New_tuijian")<>"" then
    rs("New_tuijian")=Request("New_tuijian")
    else 
    rs("New_tuijian")=False
    end if
    if Request("shenhe")<>"" then
    rs("shenhe")=Request("shenhe")
    else 
    rs("shenhe")=False
    end if
    
    if Request("Pic")<>""then
    rs("Ispic")=1
    else
    rs("Ispic")=0
    end if
    rs("time")=Date()
    rs("admin")=Session(GaobeiManageUser)
    rs.update
    rs.close 
    response.redirect "Ku_news.asp"
    end if
%>
<%
    if request("Action")="Modify" then
    CheckAdmin2
    id=request.form("id")
    Title=strFilter(request.form("Title"))
    G_webclass=strFilter(request("G_webclass"))     
    Content=strFilter(request.form("Content"))
    Pic=strFilter(request.form("Pic"))
    If Title="" Then
    Response.Write "<script>alert(""请输新闻标题!"");location.href=""javascript:history.back()"";</script>"
    Response.end()
    end if
    If G_webclass="0" Then
    Response.Write "<script>alert(""你忘记选择新闻类别了!"");location.href=""javascript:history.back()"";</script>"
    Response.end()
    end if    
    If Content="" Then
    Response.Write "<script>alert(""请输新闻内容!"");location.href=""javascript:history.back()"";</script>"
    Response.end()
    end if
    rs.open "select * From ku_news where id="&id,conn,3,2
    rs("Title")=Title
    rs("class")=G_webclass
    rs("Content")=Content
    rs("pic")=pic
    if Request("New_tuijian")<>"" then
    rs("New_tuijian")=Request("New_tuijian")
    else 
    rs("New_tuijian")=False
    end if
    if Request("shenhe")<>"" then
    rs("shenhe")=Request("shenhe")
    else 
    rs("shenhe")=False
    end if    
    if Request("Pic")<>""then
    rs("Ispic")=1
    else
    rs("Ispic")=0
    end if
    'rs("Time")=Date()
    rs("admin")=Session(GaobeiManageUser)
    rs.update 
    rs.close 
    response.Redirect("Ku_news.asp")
    end if 
%>
<%
    if request("Action")="Del" then
    CheckAdmin2
    id=Request.QueryString("id")
    delsql="delete From ku_news where id="&id
    conn.execute(delsql)
    conn.close
    response.redirect"Ku_news.asp"
    end if
%>
<%
    if request("Action")="pass" then
    CheckAdmin2
    id=Request.QueryString("id")
    Set rs = Server.CreateObject("ADODB.Recordset")
    sql="select * from [Ku_News] where id="&id
    rs.open sql,conn,1,3
    rs("shenhe")=true
    rs.update
    rs.close
    response.redirect"Ku_news.asp"
    end if
%>